<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta charset="UTF-8">

    <title>Git项目管理选项</title>
    <style>
        .container {
            padding: 1px;
            min-width: 300px;
        }
        
        .icon-button {
            cursor: pointer;
            color: #666;
            background: none;
            border: none;
            padding: 5px;
        }

        .icon-button:hover {
            color: #333;
        }

        /* 弹窗样式 */
        .modal-area {
            position: fixed;
            top: 0px;
            left: 0;
            width: 100%;
            height: 100%;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .modal {
            background-color: rgba(0, 0, 0, 0.5);
            z-index: 1000;
            display: none;
        }

        .modal-content {
            background-color: white;
            top: -100px;
            padding: 10px 20px 20px;
            border-radius: 5px;
            min-width: 300px;
            max-width: 90%;
            max-height: 90vh;
            overflow-y: auto;
            position: relative;
            /* 添加阴影效果 */
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        }

        .modal-header {
            padding: 0;
            margin-bottom: 15px;
            cursor: move;
            user-select: none;
            display: flex;
            justify-content: space-between;
            align-items: center;
            border-bottom: 1px solid #eee;
        }

        /* .modal-header h3 {
            margin: 0;
            padding: 0;
        } */

        .modal-close {
            cursor: pointer;
            font-size: 20px;
            color: #666;
            background: none;
            border: none;
            padding: 0 5px;
        }

        .modal-close:hover {
            color: #333;
        }

        .input-group {
            margin-bottom: 15px;
        }

        .input-group label {
            display: block;
            margin-bottom: 5px;
        }

        .input-group input,
        .input-group select {
            width: 100%;
            padding: 5px 0 5px 0;
            border: 1px solid #ddd;
            border-radius: 3px;
        }

        .modal-footer {
            margin-top: 20px;
            text-align: right;
        }

        .modal-footer button {
            cursor: pointer;
            margin-left: 10px;
            padding: 5px 15px;
            border: none;
            border-radius: 3px;
        }

        #save-button {
            background-color: #4CAF50;
            color: white;
        }

        #cancel-buttom {
            background-color: #f44336;
            color: white;
        }

        .highlight {
            background-color: #750eb9;
            color:wheat;
        }

        table {
            width: 100%;
            border-collapse: collapse;
            padding: 5px 15px;
            border: none;
            border-radius: 3px;
            /* cursor: pointer; */
       }

        th, td {
            border: 1px solid #ddd;
            text-align: left;
        }

        th {
            padding: 8px;
            background-color: #f2f2f2;
        }

        td {
            padding: 0 5px 0 5px;
        }

        .permission-link {
            color: inherit;
            font-weight: normal;
            text-decoration: none;
            
        }
        .permission-link:hover {
            color: rgba(0, 0, 255, 0.9);
            font-weight: bold;
            text-decoration: underline;
        }

        .project-link {
            color: inherit;
            font-weight: normal;
            text-decoration: none;
            
        }
        .project-link:hover {
            color: rgba(0, 0, 255, 0.9);
            /* font-weight: bold; */
            text-decoration: underline;
        }

        /* 响应式布局调整 */
        @media screen and (max-width: 480px) {
            .modal-content {
                width: 95%;
                margin: 10px;
                padding: 15px;
            }

            .permission-container {
                gap: 5px;
            }

            .permission-item {
                font-size: 14px;
            }

            .modal-buttons button {
                padding: 8px 12px;
                font-size: 14px;
            }
        }
    </style>

    <!-- 引入 Font Awesome -->
    <!-- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css"> -->
    <link rel="stylesheet" href="libs/font-awesome/6.5.1/css/all.min.css">
</head>

<body>
    <div class="container">
    
        <div style="width: 100%; margin: 0; background-color: #4CAF50;">
            <font size="5">Git Helper Settings</font>
            <button class="icon-button" title="帮助" id="helperBtn">
                <i class="fas fa-question-circle"></i>
            </button>
        </div>
        <br>

        <!-- 维护区容器 -->
        <div style="width: 100%;">
            <div style="float: left; width: 50%;">
                <!-- 产品维护区 -->
                <div class="section" id="product-maintenance" style="float: left; width: 50%;">
                    <div>
                        <label for="product-select">产品:</label>
                        <select id="product-select">
                            <option value="all">全部</option>
                            <!-- 其他产品选项将通过 JavaScript 动态添加 -->
                        </select>
                        <button class="icon-button" title="按产品筛选" id="projectsFilterByProductBtn">
                            <i class="fas fa-filter"></i>
                        </button>
                        <button class="icon-button" title="增加一个新产品" id="productAddbtn">
                            <i class="fas fa-plus"></i>
                        </button>
                        <button class="icon-button" title="编辑当前选中的产品" id="productEditbtn">
                            <i class="fas fa-edit"></i>
                        </button>
                        <button class="icon-button" title="删除当前选中的产品" id="productDeleteBtn">
                            <i class="fas fa-trash"></i>
                        </button>
                    </div>
                </div>

                <!-- 分类维护区 -->
                <div class="section" id="category-maintenance">
                    <div>
                        <label for="category-select">分类:</label>
                        <select id="category-select">
                            <option value="all">全部</option>
                            <!-- 其他分类选项将通过 JavaScript 动态添加 -->
                        </select>
                        <button class="icon-button" title="按分类筛选" id="projectsFilterByCategoryBtn">
                            <i class="fas fa-filter"></i>
                        </button>
                        <button class="icon-button" title="增加一个新分类" id="categoryAddbtn">
                            <i class="fas fa-plus"></i>
                        </button>
                        <button class="icon-button" title="编辑当前选中的分类" id="categoryEditbtn">
                            <i class="fas fa-edit"></i>
                        </button>
                        <button class="icon-button" title="删除当前选中的分类" id="categoryDeleteBtn">
                            <i class="fas fa-trash"></i>
                        </button>
                    </div>
                </div>
            </div>
            <!-- 产品功能操作区 -->
            <div class="section" id="project-maintenance" style="float: right; width: 50%; text-align-last:right">
                <div>
                    <label>项目:</label>
                    <!-- <button class="icon-button" title="根据已选择的产品和分类条件筛选" id="projectsFilterBtn">
                        <i class="fas fa-filter"></i>
                    </button> -->
                    <button class="icon-button" title="增加一个新项目" id="projectAddbtn">
                        <i class="fas fa-plus"></i>
                    </button>
                    <button class="icon-button" title="根据已选择的产品和分类条件删除项目" id="projectDeleteBatchBtn">
                        <i class="fas fa-trash"></i>
                    </button>
                    <button class="icon-button" title="根据项目修复缺少的产品和分类" id="fixedProductAndCatoryByProjectBtn">
                        <i class="fas fa-medkit"></i>
                    </button>
                    <!-- 隐藏的文件输入 -->
                    <input type="file" id="projectImportInput" accept=".json" style="display: none;">
                    <button type=" button" id="projectImportBtn" class="icon-button" title="导入项目资料">
                    <i class="fas fa-file-import"></i>
                    </button>
                    <button type="button" id="projectExportBtn" class="icon-button" title="根据已选择的产品和分类条件导出项目资料">
                        <i class="fas fa-file-export"></i>
                    </button>
                </div>
            </div>
        </div>
        <br>
        <span><hr></span>
        
        <!-- 项目表格 -->
        <table>
            <thead>
                <tr>
                    <th hidden>ID</th>
                    <th>序号</th>
                    <th>产品</th>
                    <th>名称</th>
                    <th>模块分类</th>
                    <th>模块地址</th>
                    <th>权限</th>
                    <th style="width: 10%; align-self: self-end; text-align: right;">操作</th>
                </tr>
            </thead>
            <tbody id="project-table-body">
                <!-- <tr>
                    <td>12345</td>
                    <td>后端</td>
                    <td>http://example.com</td>
                    <td>branches, tags</td>
                    <td>qz_one2</td>
                    <td>1</td>
                    <td>操作 -->
                <!-- <button class="icon-button" title="行编辑" onclick="openModal('edit')">
                            <i class="fas fa-edit"></i>
                        </button>
                        <button class="icon-button" title="行删除">
                            <i class="fas fa-trash"></i>
                        </button> -->
                </td>
                </tr>
                <!-- 可以根据需要添加更多行 -->
            </tbody>
        </table>

    </div>

    <!-- 产品弹窗
     代码 - product-code
     名称 - product-name
    -->
    <div id="product-modal" class="modal modal-area">
        <div class="modal-area" id="product-modal-area">
        <div class="modal-content">
            <div class="modal-header" id="product-modal-header">
                <h2 id="modal-title">产品 - 查看</h2>
                <span class="modal-close" style="cursor:pointer;">&times;</span>
            </div>
            <div class="modal-body">
                <div class="input-group">
                    <label for="product-code">产品代码:</label>
                    <input type="text" id="product-code">
                </div>
                <div class="input-group">
                    <label for="product-name">产品名称:</label>
                    <input type="text" id="product-name">
                </div>
            </div>
            <div class="modal-footer">
                <button id="save-button">保存</button>
                <button id="cancel-button">取消</button>
            </div>
        </div>
        </div>
    </div>

    <!-- 分类弹窗
     代码 - category-code
     名称 - category-name
    -->
    <div id="category-modal" class="modal modal-area">
        <div class="modal-area" id="category-modal-area">
        <div class="modal-content">
            <div class="modal-header" id="category-modal-header">
                <h2 id="modal-title">分类 - 查看</h2>
                <span class="modal-close" style="cursor:pointer;">&times;</span>
            </div>
            <div class="modal-body">
                <div class="input-group">
                    <label for="category-code">分类代码:</label>
                    <input type="text" id="category-code">
                </div>
                <div class="input-group">
                    <label for="category-name">分类名称:</label>
                    <input type="text" id="category-name">
                </div>
            </div>
            <div class="modal-footer">
                <button id="save-button">保存</button>
                <button id="cancel-button">取消</button>
            </div>
        </div>
        </div>
    </div>

    <!-- 项目弹窗
     地址 - project-url
     产品 - project-code
     分类 - project-category
     编译 - project-serial
    -->
    <div id="project-modal" class="modal modal-area">
        <div class="modal-area" id="project-modal-area">
        <div class="modal-content" id="project-modal-content">
            <div class="modal-header" id="project-modal-header">
                <h2 id="modal-title">项目 - 查看</h2>
                <span class="modal-close" style="cursor:pointer;">&times;</span>
            </div>
            <div class="modal-body">
                <div class="input-group" hidden>
                    <label for="project-code">代码:</label>
                    <input type="text" id="project-code">
                </div>
                <div class="input-group">
                    <label for="project-url">地址:</label>
                    <input type="text" id="project-url">
                </div>
                <div class="input-group">
                    <label for="project-name">名称:</label>
                    <input type="text" id="project-name">
                </div>
                
                <div class="input-group">
                    <div class="input-group-item">
                        <span><label for="project-category">分类:</label><select id="project-category"></select></span>
                    </div>
                    <div class="input-group-item">
                        <span><label for="product-code">产品归属:</label><select id="product-code"></select></span>
                    </div>
                </div>
                <div class="permission-container">
                    <label>权限：</label>
                    <label class="permission-item">
                        <input type="checkbox" name="project-permission" value="branches" checked> 分支
                    </label>
                    <label class="permission-item">
                        <input type="checkbox" name="project-permission" value="tags" checked> 标签
                    </label>
                    <label class="permission-item">
                        <input type="checkbox" name="project-permission" value="members" checked> 成员
                    </label>
                    <label class="permission-item">
                        <input type="checkbox" name="project-permission" value="repository"> 仓库
                    </label>
                    <label class="permission-item">
                        <input type="checkbox" name="project-permission" value="edit"> 项目
                    </label>
                    <label class="permission-item">
                        <input type="checkbox" name="project-permission" value="commits" checked> 提交
                    </label>
                </div>

                <div class="input-group">
                    <label for="project-serial">编译顺序:</label>
                    <input type="text" id="project-serial">
                </div>
            </div>
            <div class="modal-footer">
                <button id="save-button">保存</button>
                <button id="cancel-button">取消</button>
            </div>
        </div>
        </div>
    </div>

    <!-- 帮助模态框 -->
    <div id="help-modal" class="modal modal-area" style="display: none;">
        <div class="modal-area" id="help-modal-area">
        <div class="modal-content" id="help-modal-content">
            <div class="modal-header" id="help-modal-header">
                <h2>操作说明</h2>
                <!-- <span class="modal-close" style="cursor:pointer;">&times;</span> -->
            </div>
            <div class="modal-body">
                <h3>操作按钮说明</h3>
                <ul>
                    <li><strong>导入项目:</strong> 点击此按钮以导入项目数据，支持 JSON 格式。</li>
                    <li><strong>导出项目:</strong> 点击此按钮以导出当前项目数据为 JSON 文件。</li>
                    <li><strong>增加项目:</strong> 点击此按钮以添加新的项目。</li>
                    <li><strong>编辑项目:</strong> 选择项目后，点击此按钮以编辑选定的项目。</li>
                    <li><strong>删除项目:</strong> 选择项目后，点击此按钮以删除选定的项目。</li>
                    <li><strong>增加分类:</strong> 点击此按钮以添加新的分类。</li>
                    <li><strong>编辑分类:</strong> 选择分类后，点击此按钮以编辑选定的分类。</li>
                    <li><strong>删除分类:</strong> 选择分类后，点击此按钮以删除选定的分类。</li>
                    <li><strong>增加产品:</strong> 点击此按钮以添加新的产品。</li>
                    <li><strong>编辑产品:</strong> 选择产品后，点击此按钮以编辑选定的产品。</li>
                    <li><strong>删除产品:</strong> 选择产品后，点击此按钮以删除选定的产品。</li>
                </ul>
            </div>
            <!-- <div class="modal-footer">
                <button onclick="toggleHelpModal()">关闭</button>
            </div> -->
        </div>
        </div>
    </div>

    <script src="scripts/application/Application.js"></script>
    <script src="scripts/common/Storage.js"></script>
    <script src="scripts/domain/Product.js"></script>
    <script src="scripts/service/ProductService.js"></script>
    <script src="scripts/ui/ProductModal.js"></script>
    <script src="scripts/ui/ProductUi.js"></script>
    <script src="scripts/domain/Category.js"></script>
    <script src="scripts/service/CategoryService.js"></script>
    <script src="scripts/ui/CategoryModal.js"></script>
    <script src="scripts/ui/CategoryUi.js"></script>
    <script src="scripts/domain/Project.js"></script>
    <script src="scripts/service/ProjectService.js"></script>
    <script src="scripts/ui/ProjectModal.js"></script>
    <script src="scripts/ui/ProjectUi.js"></script>
    <script src="options.js"></script>
</body>

</html>